package me.itsoo.artemis.framework.repository.interceptor;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import me.itsoo.artemis.framework.ioc.lang.Matches;
import me.itsoo.artemis.framework.repository.executor.SqlExecutor;
import me.itsoo.artemis.framework.repository.mapper.MapperDefinition;

/**
 * DemoSqlInterceptor1
 *
 * @author zxy
 * @version 0.0.1
 * @since 2023/5/23
 */
@Slf4j
@Matches("executeUpdate")
public class DemoSqlInterceptor1 implements SqlInterceptor {

    @Override
    @SneakyThrows
    public <T> T execute(SqlExecutor sqlExecutor, MapperDefinition md, Invocation invocation) {
        try {
            log.info(">>> DemoSqlInterceptor1");
            return (T) invocation.proceed();
        } finally {
            log.info("<<< DemoSqlInterceptor1");
        }
    }
}
